#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	int fds[2];
	pipe(fds);

	if(fork()==1)
	{
		close(fds[1]);
		char buf[100]={0};
		read(fds[0],buf,100);
		printf("child, buf=[%s]\n",buf);
		close(fds[0]);
		exit(0);
	}
	else
	{
		close(fds[0]);
		char *msg="sdfgiuttt";
		sleep(2);
		write(fds[1],msg,strlen(msg));
		close(fds[1]);
	}
}
